`
https://leetcode.cn/problems/splitting-a-string-into-descending-consecutive-values/
`

/**
 * @param {string} s
 * @return {boolean}
 */
var splitString = function (s) {
  let isOk = false
  const track = []

  function backtrack(start) {
    if (isOk) return

    if (start === s.length) {
      if (track.length >= 2) isOk = true
      return
    }

    for (let i = start + 1; i <= s.length; i++) {
      const currentStr = +s.slice(start, i)
      if (currentStr === "") continue; // 跳过空字符串

      // 转换为 BigInt 处理大数
      const currentNum = BigInt(currentStr);

      if (track.length === 0) {
        // 第一次分割需确保剩余部分非空
        if (i === s.length) continue;
        track.push(currentNum);
        backtrack(i);
        track.pop();
      } else {
        const prev = track[track.length - 1];
        if (currentNum + 1n === prev) {
          track.push(currentNum);
          backtrack(i);
          track.pop();
        }
      }
    }
  }

  backtrack(0)
  return isOk
};